import request from '@/utils/request'

// 发送验证码
export function sendCode(mobile) {
  return request({
    url: '/user/sms/sendSms',
    method: 'post',
    data: { mobile }
  })
}

// 用户注册
export function register(data) {
  return request({
    url: '/user/user/register',
    method: 'post',
    data
  })
}

// 完善用户信息
export function completeInfo(userId, data) {
  return request({
    url: '/user/complete',
    method: 'post',
    params: { userId },
    data
  })
}

// 用户登录
export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

// 检查用户是否存在
export function checkUser(mobile) {
  return request({
    url: '/user/check',
    method: 'post',
    params: { mobile }
  })
}

// 获取用户信息
export function getUserInfo(userId) {
  return request({
    url: '/user/info',
    method: 'get',
    params: { userId }
  })
}
